<%-- 
    Document   : appraisalcontent
    Created on : 05 4, 11, 5:17:54 PM
    Author     : Lee
--%>

<%@page import="com.cashmate.hibernate.pojo.Matrixcriteria"%>
<%@page import="java.util.ArrayList"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<s:div id="matrix">
    <s:form action="get-borrower-cmform" theme="simple" cssStyle="position: relative; left: 550px; font-size: 11px !important; width: 450px;">
        <s:label cssStyle="font-size: 11px !important">Enter the Loan Verification No: </s:label>
        <s:textfield name="catvalue" value="matrix" cssStyle="display: none" />
        <sj:autocompleter list="%{#lacm.lacmList}" indicator="true" cssClass="autocomplete" id="autocomplete" name="borrowerinfo" selectBox="true" />
        <sj:submit id="go" button="true" cssClass="ui-state-default" cssStyle="font-size:12px; visibility: hidden" value="Go" />
    </s:form>
    <s:form id="matrixform" action="add-matrix" theme="simple">
        <!--        form-->
        <s:div>
            <table border="0" width="100%" cellspacing="0" cellpadding="0">
                <tr>
                    <td><s:label>Document</s:label></td><td><s:textfield id="docnoci" cssStyle="font-size: 11px; width: 100px;" value="Credit Matrix" name="doctype" label="Document No." /></td>
                    <td><s:label>Document No.</s:label></td><td><s:textfield id="docrefnoci" cssStyle="font-size: 11px; width: 100px;" name="docno"  label="Document Ref No." /></td>
                    <td><s:label>Document Date</s:label></td><td><s:textfield name="docdate" cssStyle="font-size: 11px; width: 100px" label="Document Date" readonly="true" value="%{#request['loanver'].documents.documentdate}" /></td>
                    <td style="display: none"><s:label>Employee Id</s:label></td><td style="display: none"><s:textfield name="employeeid" cssStyle="font-size: 11px; width: 100px;" value="%{#session['employee'].idnumber}" readonly="true" label="Employee Id"/></td>
                    </tr>
                    <tr>
                        <td><s:label>Document Ref</s:label></td><td><s:textfield readonly="true" id="docreftypeci" cssStyle="font-size: 11px; width: 100px;" name="docreftypeci" label="Document Ref Type" value="Loan Application" /></td>
                    <td><s:label>Document Ref No.</s:label></td><td><s:textfield readonly="true" id="docrefnoci" cssStyle="font-size: 11px; width: 100px;" name="docrefnoci" value="%{#request['loanver'].documents.documentno}" label="Document Ref No." /></td>
                    <td><s:label>Document Ref Date</s:label></td><td><s:textfield readonly="true" id="docrefnoci" cssStyle="font-size: 11px; width: 100px;" name="docrefnoci" value="%{#request['loanver'].documents.documentdate}" label="Document Ref No." /></td>
                    <td style="display: none"><s:label>Loan Verification ID</s:label></td><td style="display: none"><s:textfield name="loanverid" cssStyle="font-size: 11px; width: 100px" label="loanverid" readonly="true" value="%{#request['loanver'].loanverificationid}" /></td>
                    <td style="display: none"><s:label>Loan Application No.</s:label></td><td style="display: none"><s:textfield name="loanappid" label="Loan Application No." value="%{#request['loaninfo'].loanappid}"/></td>
                    </tr>
                    <tr>

                    </tr>
                    <tr>
                        <td colspan="6" style="font-size: 14px; font-weight: bold;"><hr /></td>
                    </tr>
                </table>
        </s:div>
        <s:div cssStyle="height: 380px; overflow: auto; border-color: black">
            <s:iterator value="#request.matrixcatcritlist" status="stat" var="cat">
                <s:action executeResult="false" name="get-matrixcateginfo" var="mcateginfo">
                    <s:param name="matrixcategidparam" value="#stat.index" />
                </s:action>
                <table width="60%">
                    <tr>
                        <td colspan="6" style="font-size: 14px; font-weight: bold;"><s:label value="%{#mcateginfo.category.categname}" /></td>
                    </tr>
                    <tr>
                        <td colspan="6" style="font-size: 14px; font-weight: bold;"><hr /></td>
                    </tr>
                    <s:set name="statcount" value="#stat.count" var="statcount" />
                    <tr style="display: none"><td><s:label>Percentage:</s:label><s:textfield name="percent" value="%{#mcateginfo.category.percentage}" id="%{#statcount}" /></td></tr>
                    <%--<tr><td><s:textfield name="percentage" cssStyle="display: none" /></td></tr>--%>
                    <tr style="font-weight: bold; text-align: center">
                        <td>Criteria</td><td>Rating</td><td style="display: none">Criteria Value</td>
                    </tr>
                    <s:iterator value="%{#mcateginfo.listCriterias}" status="istatus">
                        <s:set name="istatcount" value="#istatus.count" var="istatcount" />
                        <tr>
                            <td><s:label name="criterianame" /></td>
                            <td><s:select
                                    cssClass="rating"
                                    id="%{#statcount}"
                                    name="rating"
                                    cssStyle="width: 60px;"
                                    list="{'1','2','3','4','5','6','7','8','9','10'}"
                                    headerKey="0"
                                    headerValue=""
                                    emptyOption="false"
                                    value="" /></td>
                                <%--<td><s:textfield name="totalvalue" cssStyle="display: none"/></td>--%>
                            <td style="display: none"><s:textfield name="totalvalue" cssClass="totalvalue" id="" /></td>
                            <td style="display: none"><s:textfield name="matrixcategid" value="%{#mcateginfo.category.matrixcategid}" /></td>
                            <td style="display: none"><s:textfield name="criteriaid" /></td>
                        </tr>

                    </s:iterator>
                    <s:set name="rname" value="requirementname" var="rname" />
                    <s:set name="statcount" value="#stat.count" var="statcount" />
                    <tr>
                        <td style="display: none"><s:label>Total Rating</s:label> <label value="<s:property value='#stat.count'/>" />: <s:textfield readonly="true" name="totalrating" id="%{#statcount}" value="0" /></td>
                        <td style="display: none"><s:label>Perfect Rating</s:label> <label value="<s:property value='#stat.count' />"/>: <s:textfield readonly="true" name="perfectrating" id="%{#statcount}" value="%{#mcateginfo.perfectrating}" /></td>
                        <td style="display: none"><s:label>Percent</s:label> <label value="<s:property value='#stat.count' />"/>: <s:textfield readonly="true" name="percentage" id="%{#statcount}" value="0" /></td>
                        </tr>
                    </table>
            </s:iterator>
            <table style="display: none">
                <tr>
                    <td colspan="6" style="font-size: 14px; font-weight: bold;"><s:label>Matrix Income</s:label></td>
                    </tr>
                    <tr>
                        <td colspan="6" style="font-size: 14px; font-weight: bold;"><hr /></td>
                    </tr>
                    <tr>
                        <td>Type</td>
                        <td><s:select
                            cssStyle="width: 40px;"
                            list="{'Gross Income','Other Income','Expenses'}"
                            headerKey="-1"
                            headerValue=""
                            emptyOption="false"
                            value="" /></td>
                    <td>Description</td>
                    <td><s:textfield name="desc" /></td>
                    <td>Amount</td>
                    <td><s:textfield name="amt" /></td>
                </tr>
            </table>
            <table width="40%" style="float: left">
                <tr>
                    <td>Credit Rating: </td>
                    <td><s:textfield name="total" id="total" value="0" />%</td>
                </tr>
            </table>
        </s:div>
        <s:div id="buttons" cssStyle="float:right">
            <sj:submit cssClass="ui-state-default" value="Save Credit Matrix" button="true" cssStyle="float:left;margin-top:2px;font-size:12px !important;font-family: Tahoma, Geneva, sans-serif !important;" />
            <%--<sj:a button="true" 
                  cssClass="default" 
                  cssStyle="float:left;
                  height:22px !important;
                  margin-top:2px;
                  font-size:12px !important;
                  line-height: 0;
                  font-family: Tahoma, Geneva, sans-serif;">
                Cancel
            </sj:a>--%>
        </s:div>
    </s:form>
</s:div>